package com.lotusfall.pojo.s1;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 *
 */
@Component("stu")  // 交给Spring创建对象，就是在容器启动时创建
public class Student {
    @Value("张三")
    private String name;
    @Value("22")
    private int age;


    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
    public Student() {
        System.out.println("无参方法调用");
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
